package com.zimin.cloud.web.handler;

import com.zimin.cloud.mine.pojo.wiki.business.EbookBO;
import com.zimin.shared.pojo.Result;
import com.zimin.cloud.wiki.api.IEbookFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

@Component
public class TestHandler {

    @Autowired
    private IEbookFeign ebookFeign;

    public Mono<ServerResponse> test(ServerRequest request) {
        Result result = ebookFeign.ebookList( new EbookBO());
        return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(BodyInserters.fromValue(result));
    }


}
